<template>
  <div class="rating_container">
      <section class="star_container">
            <svg class="grey_fill" v-for="num in 5" :key="num">
                <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#star"></use>
            </svg>
      </section>
      <section class="star_overflow" :style="'width:'+rating/5*100+'%'">
            <section class="star_container">
                <svg class="orange_fill" v-for="num in 5" :key="num">
                    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#star"></use>
                </svg>
            </section>
      </section>
  </div>
</template>

<script>
export default {
    props:['rating'],
    computed:{

    }
}
</script>

<style lang="scss" scoped>
@import '~@styl/mixin.scss';
.rating_container{
    position: relative;
    @include wh(2rem,0.4rem);
    .star_overflow{
        overflow: hidden;
        position: relative;
        height: 100%;
    }
    .star_container{
        display: flex;
        position: absolute;
        width: 2rem;
        height: 0.4rem;
        top: -0.02rem;
        left: -0.02rem;
        .grey_fill{
            fill: #d1d1d1;
        }
        .orange_fill{
            fill: #ff9a0d;
        }
    }
}
</style>